﻿@page "/Cascading/Parent"

<h3>Parent</h3>

<CascadingValue Value="@Value">
    <p>
        Value: @Value
    </p>

    <p>
        <Child />
    </p>
</CascadingValue>

<Button Text="父组件按钮（无刷新）" OnClickWithoutRender="@OnClick1" />

<Button Text="父组件按钮（刷新）" OnClick="@OnClick2" />

@code {
    private string Value { get; set; } = "原始值";

    private Task OnClick1()
    {
        Value = "改变了1";
        return Task.CompletedTask;
    }

    private Task OnClick2()
    {
        Value = "改变了2";
        return Task.CompletedTask;
    }
}
